<%@page import="monster.comm.util.SpringApplicationContextFactory"%>
<%@page import="monster.flight.admin.manager.service.admin.Flight_infoService"%>
<%@page import="monster.flight.comm.util.FlightFactory"%>
<%@page import="monster.comm.util.DateUtil"%>
<%@page import="monster.flight.comm.entity.vo.FlightBay"%>
<%@page import="sun.jdbc.rowset.CachedRowSet"%>
<%@page import="monster.flight.comm.entity.vo.Flight_info"%>
<%@page import="monster.comm.database.DBManager"%>
<%@page import="monster.comm.util.SysConstant"%>
<%@page import="monster.comm.util.UserService"%>
<%@page import="monster.comm.util.Tool"%>
<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%
String type=Tool.getRequest("type",request);
String staff_name=Tool.getRequest("staff_name",request);//名字
String staff_sn=Tool.getRequest("staff_sn",request);
String st=Tool.getRequest("st",request);
String et=Tool.getRequest("et",request);
String flight_id=Tool.getRequest("flight_id",request);
String flight_no=Tool.getRequest("flight_no",request);
String flight_date=Tool.getRequest("flight_date",request);
String std=Tool.getRequest("std",request);

String station_place=Tool.getRequest("station_place",request);

String holiday_class=Tool.getRequest("holiday_class",request);
String holiday_reason=Tool.getRequest("holiday_reason",request);
String list="";
String s_staff_name = session.getAttribute("STAFF_NAME");
String s_staff_sn = session.getAttribute("STAFF_SN");

if(s_staff_name==null){
	out.println("{\"id\":-100,\"name\":\"没有登录\"}");
	return;
}else{
	try{
		
		DBManager db = new DBManager();
		String dateTime = DateUtil.getDate("yyyy-MM-dd HH:mm:ss");
		if(type.equals("1")){		
			String sql="insert into staff_ran_plan(flight_id,flight_no,flight_date,std,staff_name,staff_sn,ran_start_datetime,end_start_datetime,op_name,op_sn,op_datetime)"
				+"values("+flight_id+",'"+flight_no+"','"+flight_date+"','"+std+"','"+staff_name+"',"+staff_sn+",'"+st+"','"+et+"','"+s_staff_name+"',"+s_staff_sn+",'"+dateTime+"')";				
			db.update(sql);
		}else if(type.equals("2")){
			String sql="insert into STAFF_STATION_PLAN(STATION_PLACE,staff_name,staff_sn,STATION_START_DATETIME,STATION_END_DATETIME,op_name,op_sn,op_datetime)"
				+"values("+station_place+"','"+staff_name+"',"+staff_sn+",'"+st+"','"+et+"','"+s_staff_name+"',"+s_staff_sn+",'"+dateTime+"')";			
			db.update(sql);
		}else if(type.equals("3")){
			String sql="insert into STAFF_HOLIDAY_PLAN(HOLIDAY_CLASS,HOLIDAY_REASON,staff_name,staff_sn,HOLIDAY_START_DATETIME,HOLIDAY_END_DATETIME,op_name,op_sn,op_datetime)"
				+"values("+holiday_class+"','"+holiday_reason+"','"+staff_name+"',"+staff_sn+",'"+st+"','"+et+"','"+s_staff_name+"',"+s_staff_sn+",'"+dateTime+"')";				
			db.update(sql);
		}
		list="{\"id\":100}";

		
	}catch(Exception e){
		 e.printStackTrace();
		 list="{\"id\":-200,\"name\":\"程序异常\"}";
	}
	
	out.println(list);

}
%>
